Event handlers 'listen' for user driven activity on a web page. When they 'hear' the specified activity they activate or 'fire'. Developers use them to trigger activity and functionality on a web page. Event handlers most often call a JavaScript function to perform the activity.
This type of development/programming is called 'Event Driven'. If the user doesn't trigger the Event with their actions then it will not run. A lot of the functionality of a web page is event driven based upon the activity of the user and how they are interacting with the content of the web page. This is part of the User Experience for the customer of the web page.
There are three ways to apply event handlers. You can apply event handlers using HTML and/or JavaScript. Each of the methods have their own syntax, rules and expectations. Each method has its own advantages and disadvantages. Choosing which method to apply an event handlers can be impacted by a number of things.
The methods of applying event handlers
Note: You may change the HTML as needed to complete your task.